#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
class date
{
public:
    date(int year, int month, int day)
    {
        _year = year;
        _month = month;
        _day = day;
    }
    date(const date& dt)
    {
        _year = dt._year;
        _month = dt._month;
        _day = dt._day;
    }
    int getyeardays(int month, int year)const
    {

        static int monthDayArray[13] = { -1, 31, 28, 31, 30, 31, 30,31, 31, 30, 31, 30, 31 };
        if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)))
        {
            return 29;
        }
        else
        {
            return monthDayArray[month];
        }


    }
    int totel()
    {
        int totelday = 0;
        int times = _month - 1;
        while (times)
        {
            
            totelday += getyeardays(times, _year);
            times--;
        }
        totelday += _day;
        return totelday;
    }
private:
    int _year;
    int _month;
    int _day;
};


int main() {
    int year, month, day;
    cin >> year >> month >> day;
    date a(year, month, day);
    cout << a.totel() << endl;

    return 0;
}